<ui:composition template="template.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets">

    <ui:define name="head">
        <link rel="stylesheet" type="text/css"
              href="#{request.contextPath}/stylesheets/login.css"/>

        <c:if test="#{user.authenticated}">
            <script type="text/javascript">
                window.onload = function () {
                    window.location = "#{request.contextPath}/home";
                };
            </script>
        </c:if>
    </ui:define>

    <ui:define name="content">
        <c:if test="#{not user.authenticated}">
            <div class="LoginPage container">
                <c:if test="#{not empty param.error}">
                    <div class="alert alert-warning" style="width: 290px;margin:0 auto;text-align:center;">您的登录尝试失败,请再试一次。</div>
                    <c:if test="#{not empty param.debug}">
                        <div class="alert alert-warning">
                            #{SPRING_SECURITY_LAST_EXCEPTION.getClass().simpleName}:
                            #{SPRING_SECURITY_LAST_EXCEPTION.message}</div>
                    </c:if>
                </c:if>

                <form action="j_spring_security_check" method="POST">
                    <div class="leorow">
                        <div class="leocol-xs-12">
                            <div class="panel panel-default" >
                                <!--                                <div class="leopanel-heading">-->
                                <!--                                    <h3>登录<span class="blue">DataCleaner</span>-->
                                <!--										<span class="orange">monitor</span>-->
                                <!--                                    </h3>-->
                                <h3 class="leoh3"><span class="leoblue">数据质量控制管理系统</span></h3>
                                <!--                                </div>-->
                                <div class="panel-body">
                                    <div class="form-group">
                                        <label for="inputUsername" class="sr-only">Username</label> <input
                                            name="j_username" type="text" id="inputUsername"
                                            class="form-control" placeholder="用户名"
                                            required="required" autofocus="autofocus"
                                            value="#{param['email']}"/>
                                    </div>

                                    <div class="form-group">
                                        <label for="inputPassword" class="sr-only">Password</label> <input
                                            name="j_password" type="password" id="inputPassword"
                                            class="form-control" placeholder="密码"
                                            required="required"/>
                                    </div>

                                    <div class="checkbox">
                                        <label>
                                            <input type="checkbox" name="rememberMe" value="true"/> 记住密码
                                        </label>
                                    </div>

                                    <input type="hidden" name="r" value="#{param['r']}"/>

                                    <button class="btn btn-lg btn-primary btn-block" type="submit">
                                        <span class="glyphicon glyphicon-log-in" aria-hidden="true"/>
                                        <span>登录</span>
                                    </button>
                                </div>
                            </div>
                        </div>

                        <c:if test="#{monitorUIPreferences.showDemoAccounts}">
                            <!--							<div class="col-xs-12 col-sm-4">-->
                            <!--								<div class="panel panel-default">-->
                            <!--									<div class="panel-heading">模拟账户</div>-->
                            <!--									<div class="panel-body">-->
                            <!--										<p>尝试使用以下任何演示凭据登录:</p>-->
                            <!--										<ul>-->
                            <!--											<li>admin/admin: “演示”工作得管理员.</li>-->
                            <!--											<li>viewer/viewer: “演示”工作的仪表板查看器</li>-->
                            <!--										</ul>-->
                            <!--									</div>-->
                            <!--								</div>-->
                            <!--							</div>-->
                        </c:if>
                    </div>
                </form>

            </div>
        </c:if>
    </ui:define>
</ui:composition>
